package labox.innovation.config;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import javolution.util.FastList;

import labox.innovation.util.L2Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GeneralConfig {
    private static final Logger _log = LoggerFactory.getLogger(GeneralConfig.class.getName());

    private static final String GENERAL_CONFIG_FILE = "./config/general.properties";

    // --------------------------------------------------
    // General Settings
    // --------------------------------------------------

    public static int ITEMDROPNUMS;

    /**
     * 寻路系统最大搜索节点数
     */
    public static int PATHFINDING_MAX_NODE;

    /**
     * 角色坐标同步间隔时间（豪秒）
     */
    public static int SYNC_LOCATION_INTERVAL;

    /**
     * 游戏服务器在登录服务器上显示的业务类型（0普通服、1新服、2推荐服）
     */
    public static int SERVER_TYPE;

    public static boolean EVERYBODY_HAS_ADMIN_RIGHTS;

    public static boolean DISPLAY_SERVER_VERSION;

    /**
     * 是否标记为类别服务器
     */
    public static boolean SERVER_LIST_BRACKET;

    /**
     * 是否标记为时限服务器
     */
    public static boolean SERVER_LIST_CLOCK;

    /**
     * 是否标记为GM专用服务器
     */
    public static boolean SERVER_GMONLY;

    public static boolean GM_HERO_AURA;

    public static boolean GM_STARTUP_INVULNERABLE;

    public static boolean GM_STARTUP_INVISIBLE;

    public static boolean GM_STARTUP_SILENCE;

    public static boolean GM_STARTUP_AUTO_LIST;

    public static boolean GM_STARTUP_DIET_MODE;

    public static String GM_ADMIN_MENU_STYLE;

    public static boolean GM_ITEM_RESTRICTION;

    public static boolean GM_SKILL_RESTRICTION;

    public static boolean GM_TRADE_RESTRICTED_ITEMS;

    public static boolean GM_RESTART_FIGHTING;

    public static boolean BYPASS_VALIDATION;

    public static int GAMEGUARD_ENFORCE;

    public static boolean GAMEGUARD_PROHIBITACTION;

    public static boolean LOG_CHAT;

    public static boolean LOG_ITEMS;

    public static boolean LOG_ITEM_ENCHANTS;

    public static boolean LOG_SKILL_ENCHANTS;

    public static boolean GMAUDIT;

    public static boolean LOG_GAME_DAMAGE;

    public static int LOG_GAME_DAMAGE_THRESHOLD;

    /**
     * 是否在服务器启动的时候缓存所有玩家ID->名称的映射，（可以加快角色名注册的逻辑,会消耗大量内存）
     */
    public static boolean CACHE_CHAR_NAMES;

    public static String ITEMRANDATTRIBUE;

    /**
     * 是否启用debug模式
     */
    public static boolean DEBUG;

    /**
     * 是否启用数据包处理的debug模式
     */
    public static boolean PACKET_HANDLER_DEBUG;

    /**
     * 是否启用断言模式
     */
    public static boolean ASSERT;

    /**
     * 是否启用开发模式
     */
    public static boolean DEVELOPER;

    public static boolean ACCEPT_GEOEDITOR_CONN;

    public static boolean TEST_SERVER;

    public static boolean ALT_DEV_NO_QUESTS;

    /**
     * 是否标志服务器为测试服务器
     */
    public static boolean SERVER_LIST_TESTSERVER;

    public static int GENERAL_THREAD_CORE_SIZE;

    public static boolean DEADLOCK_DETECTOR;

    /**
     * 服务器死锁检测周期（秒）
     */
    public static int DEADLOCK_CHECK_INTERVAL;

    /**
     * 死锁线程检测到死锁发生后是否重启服务器
     */
    public static boolean RESTART_ON_DEADLOCK;

    public static boolean ALLOW_DISCARDITEM;

    public static int AUTODESTROY_ITEM_AFTER;

    public static int HERB_AUTO_DESTROY_TIME;

    public static String PROTECTED_ITEMS;

    public static List<Integer> LIST_PROTECTED_ITEMS = new FastList<Integer>();

    public static int CHAR_STORE_INTERVAL;

    /**
     * 寄售物品回写时间间隔
     */
    public static int CONSGNMENT_SAVE_INTERVAL;
    /**
     * 在线玩家时间间隔
     */
    public static int AUTO_COUNT_PLAYER_INTERVAL;

    public static boolean LAZY_ITEMS_UPDATE;

    public static boolean UPDATE_ITEMS_ON_CHAR_STORE;

    public static boolean DESTROY_DROPPED_PLAYER_ITEM;

    public static boolean DESTROY_EQUIPABLE_PLAYER_ITEM;

    public static boolean SAVE_DROPPED_ITEM;

    public static boolean EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD;

    public static int SAVE_DROPPED_ITEM_INTERVAL;

    public static boolean CLEAR_DROPPED_ITEM_TABLE;

    public static boolean AUTODELETE_INVALID_QUEST_DATA;

    public static boolean PRECISE_DROP_CALCULATION;

    public static boolean MULTIPLE_ITEM_DROP;

    public static boolean FORCE_INVENTORY_UPDATE;

    public static boolean LAZY_CACHE;

    public static int MIN_NPC_ANIMATION;

    public static int MAX_NPC_ANIMATION;

    public static int MIN_MONSTER_ANIMATION;

    public static int MAX_MONSTER_ANIMATION;

    public static int COORD_SYNCHRONIZE;

    public static boolean GRIDS_ALWAYS_ON;

    public static int GRID_NEIGHBOR_TURNON_TIME;

    public static int GRID_NEIGHBOR_TURNOFF_TIME;

    public static int GEODATA;

    public static boolean GEODATA_CELLFINDING;

    public static boolean FORCE_GEODATA;

    public static boolean MOVE_BASED_KNOWNLIST;

    public static long KNOWNLIST_UPDATE_INTERVAL;

    public static int ZONE_TOWN;

    public static boolean ACTIVATE_POSITION_RECORDER;

    public static String DEFAULT_GLOBAL_CHAT;

    public static String DEFAULT_TRADE_CHAT;

    public static boolean ALLOW_WAREHOUSE;

    public static boolean ALLOW_FREIGHT;

    public static boolean ALLOW_WEAR;

    public static int WEAR_DELAY;

    public static int WEAR_PRICE;

    public static boolean ALLOW_LOTTERY;

    public static boolean ALLOW_RACE;

    public static boolean ALLOW_WATER;

    public static boolean ALLOW_RENTPET;

    public static boolean ALLOWFISHING;

    public static boolean ALLOW_BOAT;

    public static boolean ALLOW_CURSED_WEAPONS;

    public static boolean ALLOW_MANOR;

    public static boolean ALLOW_NPC_WALKERS;

    public static boolean ALLOW_PET_WALKERS;

    public static boolean SERVER_NEWS;

    public static int COMMUNITY_TYPE;

    public static boolean BBS_SHOW_PLAYERLIST;

    public static String BBS_DEFAULT;

    public static boolean SHOW_LEVEL_COMMUNITYBOARD;

    public static boolean SHOW_STATUS_COMMUNITYBOARD;

    public static int NAME_PAGE_SIZE_COMMUNITYBOARD;

    public static int NAME_PER_ROW_COMMUNITYBOARD;

    public static int ALT_OLY_START_TIME;

    public static int ALT_OLY_MIN;

    public static long ALT_OLY_CPERIOD;

    public static long ALT_OLY_BATTLE;

    public static long ALT_OLY_WPERIOD;

    public static long ALT_OLY_VPERIOD;

    public static int ALT_OLY_CLASSED;

    public static int ALT_OLY_NONCLASSED;

    public static int ALT_OLY_REG_DISPLAY;

    public static int ALT_OLY_BATTLE_REWARD_ITEM;

    public static int ALT_OLY_CLASSED_RITEM_C;

    public static int ALT_OLY_NONCLASSED_RITEM_C;

    public static int ALT_OLY_COMP_RITEM;

    public static int ALT_OLY_GP_PER_POINT;

    public static int ALT_OLY_HERO_POINTS;

    public static int ALT_OLY_RANK1_POINTS;

    public static int ALT_OLY_RANK2_POINTS;

    public static int ALT_OLY_RANK3_POINTS;

    public static int ALT_OLY_RANK4_POINTS;

    public static int ALT_OLY_RANK5_POINTS;

    public static int ALT_OLY_MAX_POINTS;

    public static boolean ALT_OLY_LOG_FIGHTS;

    public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;

    public static boolean ALT_OLY_ANNOUNCE_GAMES;

    public static List<Integer> LIST_OLY_RESTRICTED_ITEMS = new FastList<Integer>();

    public static int ALT_OLY_ENCHANT_LIMIT;

    public static int ALT_MANOR_REFRESH_TIME;

    public static int ALT_MANOR_REFRESH_MIN;

    public static int ALT_MANOR_APPROVE_TIME;

    public static int ALT_MANOR_APPROVE_MIN;

    public static int ALT_MANOR_MAINTENANCE_PERIOD;

    public static boolean ALT_MANOR_SAVE_ALL_ACTIONS;

    public static int ALT_MANOR_SAVE_PERIOD_RATE;

    public static long ALT_LOTTERY_PRIZE;

    public static long ALT_LOTTERY_TICKET_PRICE;

    public static float ALT_LOTTERY_5_NUMBER_RATE;

    public static float ALT_LOTTERY_4_NUMBER_RATE;

    public static float ALT_LOTTERY_3_NUMBER_RATE;

    public static long ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;

    public static int FS_TIME_ATTACK;

    public static int FS_TIME_COOLDOWN;

    public static int FS_TIME_ENTRY;

    public static int FS_TIME_WARMUP;

    public static int FS_PARTY_MEMBER_COUNT;

    public static int RIFT_MIN_PARTY_SIZE;

    public static int RIFT_SPAWN_DELAY;

    public static int RIFT_MAX_JUMPS;

    public static int RIFT_AUTO_JUMPS_TIME_MIN;

    public static int RIFT_AUTO_JUMPS_TIME_MAX;

    public static float RIFT_BOSS_ROOM_TIME_MUTIPLY;

    public static int RIFT_ENTER_COST_RECRUIT;

    public static int RIFT_ENTER_COST_SOLDIER;

    public static int RIFT_ENTER_COST_OFFICER;

    public static int RIFT_ENTER_COST_CAPTAIN;

    public static int RIFT_ENTER_COST_COMMANDER;

    public static int RIFT_ENTER_COST_HERO;

    public static int DEFAULT_PUNISH;

    public static int DEFAULT_PUNISH_PARAM;

    public static boolean ONLY_GM_ITEMS_FREE;

    public static boolean JAIL_IS_PVP;

    public static boolean JAIL_DISABLE_CHAT;

    public static boolean SAVE_GMSPAWN_ON_CUSTOM;

    public static boolean DELETE_GMSPAWN_ON_CUSTOM;

    public static boolean CUSTOM_NPC_TABLE;

    public static boolean CUSTOM_ITEM_TABLES;

    public static boolean CUSTOM_ARMORSETS_TABLE;

    public static boolean CUSTOM_TELEPORT_TABLE;

    public static boolean CUSTOM_DROPLIST_TABLE;

    public static boolean CUSTOM_MERCHANT_TABLES;

    /**
     * 世界聊天等级下限设置
     */
    public static int GLOBALCHATLEVELSET;

    /**
     * 世界聊天扣钱(单位：银文)
     */
    public static int GLOBALCHATCOSTS;

    // 寄售系统相关参数
    public static float XX4;

    public static float XX8;

    public static float XX12;

    public static float XX24;

    /**
     * 购买寄售物品缴税率
     */
    public static float CONSIGNMENTDUTY;

    /**
     * 寄售分页大小
     */
    public static int CPAGESIZE;

    public static void load() {
        _log.info("Loading general Configuration Files...", Config.SERVER_ID);
        InputStream is = null;
        try {
            L2Properties General = new L2Properties();
            is = new FileInputStream(new File(GENERAL_CONFIG_FILE));
            General.load(is, "UTF-8");

            ITEMDROPNUMS = Integer.parseInt(General.getProperty("ItemDropNums", "0"));
            ITEMRANDATTRIBUE = General.getProperty("ItemRandAttribute", null);
            PATHFINDING_MAX_NODE = Integer.parseInt(General.getProperty("PathFindingMaxNode", "800"));
            SYNC_LOCATION_INTERVAL = Integer.parseInt(General.getProperty("SyncLocationInterval", "2000"));
            SERVER_TYPE = Integer.parseInt(General.getProperty("ServerType", "0"));
            EVERYBODY_HAS_ADMIN_RIGHTS = Boolean.parseBoolean(General.getProperty("EverybodyHasAdminRights", "false"));
            DISPLAY_SERVER_VERSION = Boolean.parseBoolean(General.getProperty("DisplayServerRevision", "True"));
            SERVER_LIST_BRACKET = Boolean.parseBoolean(General.getProperty("ServerListBrackets", "false"));
            SERVER_LIST_CLOCK = Boolean.parseBoolean(General.getProperty("ServerListClock", "false"));
            SERVER_GMONLY = Boolean.parseBoolean(General.getProperty("ServerGMOnly", "false"));
            GM_HERO_AURA = Boolean.parseBoolean(General.getProperty("GMHeroAura", "False"));
            GM_STARTUP_INVULNERABLE = Boolean.parseBoolean(General.getProperty("GMStartupInvulnerable", "False"));
            GM_STARTUP_INVISIBLE = Boolean.parseBoolean(General.getProperty("GMStartupInvisible", "False"));
            GM_STARTUP_SILENCE = Boolean.parseBoolean(General.getProperty("GMStartupSilence", "False"));
            GM_STARTUP_AUTO_LIST = Boolean.parseBoolean(General.getProperty("GMStartupAutoList", "False"));
            GM_STARTUP_DIET_MODE = Boolean.parseBoolean(General.getProperty("GMStartupDietMode", "False"));
            GM_ADMIN_MENU_STYLE = General.getProperty("GMAdminMenuStyle", "modern");
            GM_ITEM_RESTRICTION = Boolean.parseBoolean(General.getProperty("GMItemRestriction", "True"));
            GM_SKILL_RESTRICTION = Boolean.parseBoolean(General.getProperty("GMSkillRestriction", "True"));
            GM_TRADE_RESTRICTED_ITEMS = Boolean.parseBoolean(General.getProperty("GMTradeRestrictedItems", "False"));
            GM_RESTART_FIGHTING = Boolean.parseBoolean(General.getProperty("GMRestartFighting", "False"));
            BYPASS_VALIDATION = Boolean.parseBoolean(General.getProperty("BypassValidation", "True"));
            GAMEGUARD_ENFORCE = Integer.parseInt(General.getProperty("GameGuardEnforce", "0"));
            GAMEGUARD_PROHIBITACTION = Boolean.parseBoolean(General.getProperty("GameGuardProhibitAction", "False"));
            LOG_CHAT = Boolean.parseBoolean(General.getProperty("LogChat", "false"));
            LOG_ITEMS = Boolean.parseBoolean(General.getProperty("LogItems", "false"));
            LOG_ITEM_ENCHANTS = Boolean.parseBoolean(General.getProperty("LogItemEnchants", "false"));
            LOG_SKILL_ENCHANTS = Boolean.parseBoolean(General.getProperty("LogSkillEnchants", "false"));
            GMAUDIT = Boolean.parseBoolean(General.getProperty("GMAudit", "False"));
            LOG_GAME_DAMAGE = Boolean.parseBoolean(General.getProperty("LogGameDamage", "False"));
            LOG_GAME_DAMAGE_THRESHOLD = Integer.parseInt(General.getProperty("LogGameDamageThreshold", "5000"));

            CACHE_CHAR_NAMES = Boolean.parseBoolean(General.getProperty("CacheCharNames", "False"));

            DEBUG = Boolean.parseBoolean(General.getProperty("Debug", "false"));
            PACKET_HANDLER_DEBUG = Boolean.parseBoolean(General.getProperty("PacketHandlerDebug", "false"));
            ASSERT = Boolean.parseBoolean(General.getProperty("Assert", "false"));
            DEVELOPER = Boolean.parseBoolean(General.getProperty("Developer", "false"));
            ACCEPT_GEOEDITOR_CONN = Boolean.parseBoolean(General.getProperty("AcceptGeoeditorConn", "false"));
            TEST_SERVER = Boolean.parseBoolean(General.getProperty("TestServer", "false"));
            SERVER_LIST_TESTSERVER = Boolean.parseBoolean(General.getProperty("ListTestServers", "false"));
            ALT_DEV_NO_QUESTS = Boolean.parseBoolean(General.getProperty("AltDevNoQuests", "False"));
            GENERAL_THREAD_CORE_SIZE = Integer.parseInt(General.getProperty("GeneralThreadCoreSize", "4"));
            DEADLOCK_DETECTOR = Boolean.parseBoolean(General.getProperty("DeadLockDetector", "False"));

            DEADLOCK_CHECK_INTERVAL = Integer.parseInt(General.getProperty("DeadLockCheckInterval", "20"));
            RESTART_ON_DEADLOCK = Boolean.parseBoolean(General.getProperty("RestartOnDeadlock", "False"));

            ALLOW_DISCARDITEM = Boolean.parseBoolean(General.getProperty("AllowDiscardItem", "True"));
            AUTODESTROY_ITEM_AFTER = Integer.parseInt(General.getProperty("AutoDestroyDroppedItemAfter", "600"));
            HERB_AUTO_DESTROY_TIME = Integer.parseInt(General.getProperty("AutoDestroyHerbTime", "15")) * 1000;
            PROTECTED_ITEMS = General.getProperty("ListOfProtectedItems", "0");
            LIST_PROTECTED_ITEMS = new FastList<Integer>();
            for (String id : PROTECTED_ITEMS.split(",")) {
                LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
            }
            CHAR_STORE_INTERVAL = Integer.parseInt(General.getProperty("CharacterDataStoreInterval", "5"));
            CONSGNMENT_SAVE_INTERVAL = Integer.parseInt(General.getProperty("ConsgnmentSaveInterval", "5"));
            AUTO_COUNT_PLAYER_INTERVAL = Integer.parseInt(General.getProperty("AutoCountPlayerInterval", "5"));
            LAZY_ITEMS_UPDATE = Boolean.parseBoolean(General.getProperty("LazyItemsUpdate", "false"));
            UPDATE_ITEMS_ON_CHAR_STORE = Boolean.parseBoolean(General.getProperty("UpdateItemsOnCharStore", "false"));
            DESTROY_DROPPED_PLAYER_ITEM = Boolean.parseBoolean(General.getProperty("DestroyPlayerDroppedItem", "false"));
            DESTROY_EQUIPABLE_PLAYER_ITEM = Boolean.parseBoolean(General.getProperty("DestroyEquipableItem", "false"));
            SAVE_DROPPED_ITEM = Boolean.parseBoolean(General.getProperty("SaveDroppedItem", "false"));
            EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD = Boolean.parseBoolean(General.getProperty("EmptyDroppedItemTableAfterLoad", "false"));
            SAVE_DROPPED_ITEM_INTERVAL = Integer.parseInt(General.getProperty("SaveDroppedItemInterval", "60")) * 60000;
            CLEAR_DROPPED_ITEM_TABLE = Boolean.parseBoolean(General.getProperty("ClearDroppedItemTable", "false"));
            AUTODELETE_INVALID_QUEST_DATA = Boolean.parseBoolean(General.getProperty("AutoDeleteInvalidQuestData", "False"));
            PRECISE_DROP_CALCULATION = Boolean.parseBoolean(General.getProperty("PreciseDropCalculation", "True"));
            MULTIPLE_ITEM_DROP = Boolean.parseBoolean(General.getProperty("MultipleItemDrop", "True"));
            FORCE_INVENTORY_UPDATE = Boolean.parseBoolean(General.getProperty("ForceInventoryUpdate", "False"));
            LAZY_CACHE = Boolean.parseBoolean(General.getProperty("LazyCache", "True"));
            MIN_NPC_ANIMATION = Integer.parseInt(General.getProperty("MinNPCAnimation", "10"));
            MAX_NPC_ANIMATION = Integer.parseInt(General.getProperty("MaxNPCAnimation", "20"));
            MIN_MONSTER_ANIMATION = Integer.parseInt(General.getProperty("MinMonsterAnimation", "5"));
            MAX_MONSTER_ANIMATION = Integer.parseInt(General.getProperty("MaxMonsterAnimation", "20"));
            MOVE_BASED_KNOWNLIST = Boolean.parseBoolean(General.getProperty("MoveBasedKnownlist", "False"));
            KNOWNLIST_UPDATE_INTERVAL = Long.parseLong(General.getProperty("KnownListUpdateInterval", "1250"));
            GRIDS_ALWAYS_ON = Boolean.parseBoolean(General.getProperty("GridsAlwaysOn", "False"));
            GRID_NEIGHBOR_TURNON_TIME = Integer.parseInt(General.getProperty("GridNeighborTurnOnTime", "1"));
            GRID_NEIGHBOR_TURNOFF_TIME = Integer.parseInt(General.getProperty("GridNeighborTurnOffTime", "90"));
            GEODATA = Integer.parseInt(General.getProperty("GeoData", "0"));
            GEODATA_CELLFINDING = Boolean.parseBoolean(General.getProperty("CellPathFinding", "true"));
            FORCE_GEODATA = Boolean.parseBoolean(General.getProperty("ForceGeodata", "True"));
            COORD_SYNCHRONIZE = Integer.parseInt(General.getProperty("CoordSynchronize", "-1"));
            ZONE_TOWN = Integer.parseInt(General.getProperty("ZoneTown", "0"));
            ACTIVATE_POSITION_RECORDER = Boolean.parseBoolean(General.getProperty("ActivatePositionRecorder", "False"));
            DEFAULT_GLOBAL_CHAT = General.getProperty("GlobalChat", "ON");
            DEFAULT_TRADE_CHAT = General.getProperty("TradeChat", "ON");
            ALLOW_WAREHOUSE = Boolean.parseBoolean(General.getProperty("AllowWarehouse", "True"));
            ALLOW_FREIGHT = Boolean.parseBoolean(General.getProperty("AllowFreight", "True"));
            ALLOW_WEAR = Boolean.parseBoolean(General.getProperty("AllowWear", "False"));
            WEAR_DELAY = Integer.parseInt(General.getProperty("WearDelay", "5"));
            WEAR_PRICE = Integer.parseInt(General.getProperty("WearPrice", "10"));
            ALLOW_LOTTERY = Boolean.parseBoolean(General.getProperty("AllowLottery", "True"));
            ALLOW_RACE = Boolean.parseBoolean(General.getProperty("AllowRace", "True"));
            ALLOW_WATER = Boolean.parseBoolean(General.getProperty("AllowWater", "True"));
            ALLOW_RENTPET = Boolean.parseBoolean(General.getProperty("AllowRentPet", "False"));
            ALLOW_DISCARDITEM = Boolean.parseBoolean(General.getProperty("AllowDiscardItem", "True"));
            ALLOWFISHING = Boolean.parseBoolean(General.getProperty("AllowFishing", "True"));
            ALLOW_MANOR = Boolean.parseBoolean(General.getProperty("AllowManor", "True"));
            ALLOW_BOAT = Boolean.parseBoolean(General.getProperty("AllowBoat", "True"));
            ALLOW_CURSED_WEAPONS = Boolean.parseBoolean(General.getProperty("AllowCursedWeapons", "True"));
            ALLOW_NPC_WALKERS = Boolean.parseBoolean(General.getProperty("AllowNpcWalkers", "true"));
            ALLOW_PET_WALKERS = Boolean.parseBoolean(General.getProperty("AllowPetWalkers", "True"));
            SERVER_NEWS = Boolean.parseBoolean(General.getProperty("ShowServerNews", "False"));
            COMMUNITY_TYPE = Integer.parseInt(General.getProperty("CommunityType", "1"));
            BBS_SHOW_PLAYERLIST = Boolean.parseBoolean(General.getProperty("BBSShowPlayerList", "false"));
            BBS_DEFAULT = General.getProperty("BBSDefault", "_bbshome");
            SHOW_LEVEL_COMMUNITYBOARD = Boolean.parseBoolean(General.getProperty("ShowLevelOnCommunityBoard", "False"));
            SHOW_STATUS_COMMUNITYBOARD = Boolean.parseBoolean(General.getProperty("ShowStatusOnCommunityBoard", "True"));
            NAME_PAGE_SIZE_COMMUNITYBOARD = Integer.parseInt(General.getProperty("NamePageSizeOnCommunityBoard", "50"));
            NAME_PER_ROW_COMMUNITYBOARD = Integer.parseInt(General.getProperty("NamePerRowOnCommunityBoard", "5"));
            ALT_OLY_START_TIME = Integer.parseInt(General.getProperty("AltOlyStartTime", "18"));
            ALT_OLY_MIN = Integer.parseInt(General.getProperty("AltOlyMin", "00"));
            ALT_OLY_CPERIOD = Long.parseLong(General.getProperty("AltOlyCPeriod", "21600000"));
            ALT_OLY_BATTLE = Long.parseLong(General.getProperty("AltOlyBattle", "360000"));
            ALT_OLY_WPERIOD = Long.parseLong(General.getProperty("AltOlyWPeriod", "604800000"));
            ALT_OLY_VPERIOD = Long.parseLong(General.getProperty("AltOlyVPeriod", "86400000"));
            ALT_OLY_CLASSED = Integer.parseInt(General.getProperty("AltOlyClassedParticipants", "5"));
            ALT_OLY_NONCLASSED = Integer.parseInt(General.getProperty("AltOlyNonClassedParticipants", "9"));
            ALT_OLY_REG_DISPLAY = Integer.parseInt(General.getProperty("AltOlyRegistrationDisplayNumber", "100"));
            ALT_OLY_BATTLE_REWARD_ITEM = Integer.parseInt(General.getProperty("AltOlyBattleRewItem", "6651"));
            ALT_OLY_CLASSED_RITEM_C = Integer.parseInt(General.getProperty("AltOlyClassedRewItemCount", "50"));
            ALT_OLY_NONCLASSED_RITEM_C = Integer.parseInt(General.getProperty("AltOlyNonClassedRewItemCount", "30"));
            ALT_OLY_COMP_RITEM = Integer.parseInt(General.getProperty("AltOlyCompRewItem", "13722"));
            ALT_OLY_GP_PER_POINT = Integer.parseInt(General.getProperty("AltOlyGPPerPoint", "1000"));
            ALT_OLY_HERO_POINTS = Integer.parseInt(General.getProperty("AltOlyHeroPoints", "180"));
            ALT_OLY_RANK1_POINTS = Integer.parseInt(General.getProperty("AltOlyRank1Points", "120"));
            ALT_OLY_RANK2_POINTS = Integer.parseInt(General.getProperty("AltOlyRank2Points", "80"));
            ALT_OLY_RANK3_POINTS = Integer.parseInt(General.getProperty("AltOlyRank3Points", "55"));
            ALT_OLY_RANK4_POINTS = Integer.parseInt(General.getProperty("AltOlyRank4Points", "35"));
            ALT_OLY_RANK5_POINTS = Integer.parseInt(General.getProperty("AltOlyRank5Points", "20"));
            ALT_OLY_MAX_POINTS = Integer.parseInt(General.getProperty("AltOlyMaxPoints", "10"));
            ALT_OLY_LOG_FIGHTS = Boolean.parseBoolean(General.getProperty("AlyOlyLogFights", "false"));
            ALT_OLY_SHOW_MONTHLY_WINNERS = Boolean.parseBoolean(General.getProperty("AltOlyShowMonthlyWinners", "true"));
            ALT_OLY_ANNOUNCE_GAMES = Boolean.parseBoolean(General.getProperty("AltOlyAnnounceGames", "true"));
            LIST_OLY_RESTRICTED_ITEMS = new FastList<Integer>();
            for (String id : General.getProperty("AltOlyRestrictedItems", "0").split(",")) {
                LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
            }
            ALT_OLY_ENCHANT_LIMIT = Integer.parseInt(General.getProperty("AltOlyEnchantLimit", "-1"));
            ALT_MANOR_REFRESH_TIME = Integer.parseInt(General.getProperty("AltManorRefreshTime", "20"));
            ALT_MANOR_REFRESH_MIN = Integer.parseInt(General.getProperty("AltManorRefreshMin", "00"));
            ALT_MANOR_APPROVE_TIME = Integer.parseInt(General.getProperty("AltManorApproveTime", "6"));
            ALT_MANOR_APPROVE_MIN = Integer.parseInt(General.getProperty("AltManorApproveMin", "00"));
            ALT_MANOR_MAINTENANCE_PERIOD = Integer.parseInt(General.getProperty("AltManorMaintenancePeriod", "360000"));
            ALT_MANOR_SAVE_ALL_ACTIONS = Boolean.parseBoolean(General.getProperty("AltManorSaveAllActions", "false"));
            ALT_MANOR_SAVE_PERIOD_RATE = Integer.parseInt(General.getProperty("AltManorSavePeriodRate", "2"));
            ALT_LOTTERY_PRIZE = Long.parseLong(General.getProperty("AltLotteryPrize", "50000"));
            ALT_LOTTERY_TICKET_PRICE = Long.parseLong(General.getProperty("AltLotteryTicketPrice", "2000"));
            ALT_LOTTERY_5_NUMBER_RATE = Float.parseFloat(General.getProperty("AltLottery5NumberRate", "0.6"));
            ALT_LOTTERY_4_NUMBER_RATE = Float.parseFloat(General.getProperty("AltLottery4NumberRate", "0.2"));
            ALT_LOTTERY_3_NUMBER_RATE = Float.parseFloat(General.getProperty("AltLottery3NumberRate", "0.2"));
            ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = Long.parseLong(General.getProperty("AltLottery2and1NumberPrize", "200"));
            FS_TIME_ATTACK = Integer.parseInt(General.getProperty("TimeOfAttack", "50"));
            FS_TIME_COOLDOWN = Integer.parseInt(General.getProperty("TimeOfCoolDown", "5"));
            FS_TIME_ENTRY = Integer.parseInt(General.getProperty("TimeOfEntry", "3"));
            FS_TIME_WARMUP = Integer.parseInt(General.getProperty("TimeOfWarmUp", "2"));
            FS_PARTY_MEMBER_COUNT = Integer.parseInt(General.getProperty("NumberOfNecessaryPartyMembers", "4"));
            if (FS_TIME_ATTACK <= 0)
                FS_TIME_ATTACK = 50;
            if (FS_TIME_COOLDOWN <= 0)
                FS_TIME_COOLDOWN = 5;
            if (FS_TIME_ENTRY <= 0)
                FS_TIME_ENTRY = 3;
            if (FS_TIME_ENTRY <= 0)
                FS_TIME_ENTRY = 3;
            if (FS_TIME_ENTRY <= 0)
                FS_TIME_ENTRY = 3;
            RIFT_MIN_PARTY_SIZE = Integer.parseInt(General.getProperty("RiftMinPartySize", "5"));
            RIFT_MAX_JUMPS = Integer.parseInt(General.getProperty("MaxRiftJumps", "4"));
            RIFT_SPAWN_DELAY = Integer.parseInt(General.getProperty("RiftSpawnDelay", "10000"));
            RIFT_AUTO_JUMPS_TIME_MIN = Integer.parseInt(General.getProperty("AutoJumpsDelayMin", "480"));
            RIFT_AUTO_JUMPS_TIME_MAX = Integer.parseInt(General.getProperty("AutoJumpsDelayMax", "600"));
            RIFT_BOSS_ROOM_TIME_MUTIPLY = Float.parseFloat(General.getProperty("BossRoomTimeMultiply", "1.5"));
            RIFT_ENTER_COST_RECRUIT = Integer.parseInt(General.getProperty("RecruitCost", "18"));
            RIFT_ENTER_COST_SOLDIER = Integer.parseInt(General.getProperty("SoldierCost", "21"));
            RIFT_ENTER_COST_OFFICER = Integer.parseInt(General.getProperty("OfficerCost", "24"));
            RIFT_ENTER_COST_CAPTAIN = Integer.parseInt(General.getProperty("CaptainCost", "27"));
            RIFT_ENTER_COST_COMMANDER = Integer.parseInt(General.getProperty("CommanderCost", "30"));
            RIFT_ENTER_COST_HERO = Integer.parseInt(General.getProperty("HeroCost", "33"));
            DEFAULT_PUNISH = Integer.parseInt(General.getProperty("DefaultPunish", "2"));
            DEFAULT_PUNISH_PARAM = Integer.parseInt(General.getProperty("DefaultPunishParam", "0"));
            ONLY_GM_ITEMS_FREE = Boolean.parseBoolean(General.getProperty("OnlyGMItemsFree", "True"));
            JAIL_IS_PVP = Boolean.parseBoolean(General.getProperty("JailIsPvp", "True"));
            JAIL_DISABLE_CHAT = Boolean.parseBoolean(General.getProperty("JailDisableChat", "True"));
            SAVE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(General.getProperty("SaveGmSpawnOnCustom", "false"));
            DELETE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(General.getProperty("DeleteGmSpawnOnCustom", "false"));
            CUSTOM_NPC_TABLE = Boolean.valueOf(General.getProperty("CustomNpcTable", "false"));
            CUSTOM_ITEM_TABLES = Boolean.valueOf(General.getProperty("CustomItemTables", "false"));
            CUSTOM_ARMORSETS_TABLE = Boolean.valueOf(General.getProperty("CustomArmorSetsTable", "false"));
            CUSTOM_TELEPORT_TABLE = Boolean.valueOf(General.getProperty("CustomTeleportTable", "false"));
            CUSTOM_DROPLIST_TABLE = Boolean.valueOf(General.getProperty("CustomDroplistTable", "false"));
            CUSTOM_MERCHANT_TABLES = Boolean.valueOf(General.getProperty("CustomMerchantTables", "false"));
            GLOBALCHATLEVELSET = Integer.valueOf(General.getProperty("GlobalChatLevelSet", "15"));
            GLOBALCHATCOSTS = Integer.valueOf(General.getProperty("GlobalChatCosts", "1000"));
            XX4 = Float.parseFloat(General.getProperty("XX4", "0.03"));
            XX8 = Float.parseFloat(General.getProperty("XX8", "0.04"));
            XX12 = Float.parseFloat(General.getProperty("XX12", "0.05"));
            XX24 = Float.parseFloat(General.getProperty("XX24", "0.06"));
            CONSIGNMENTDUTY = Float.parseFloat(General.getProperty("ConsignmentDuty", "0.05"));
            CPAGESIZE = Integer.parseInt(General.getProperty("cpagesize", "20"));

        } catch (Exception e) {
            _log.error("Failed to Load " + GENERAL_CONFIG_FILE + " File.", e);
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                _log.error("InputStream close occured IOException");
            }
        }
    }
}
